window.addEventListener('scroll', () => {
    const boxes = document.querySelectorAll('.box');
    const triggerOffset = window.innerHeight * 0.8; // 触发点为可视区域高度的 80%

    boxes.forEach(box => {
        const boxTop = box.getBoundingClientRect().top;

        if (boxTop < triggerOffset) {
            box.classList.add('visible');
        } else {
            box.classList.remove('visible');
        }
    });
});